package com.feidee.data.report.dao.impl;

import com.feidee.data.report.constant.Constant;
import com.feidee.data.report.dao.IHiveDao;
import com.feidee.data.report.util.ToolUtils;
import com.feidee.fdcommon.configuration.CustomConfiguration;
import org.apache.log4j.Logger;

public class HiveDaoImpl extends BaseReportQueryDao implements IHiveDao {

    private static Logger logger = Logger.getLogger(HiveDaoImpl.class);

    @Override
    public void setup() {
        super.setup();
    }

    @Override
    public void cleanup() {
        super.cleanup();
    }

    public void setConfigurtion() {
        engineFlag = Constant.HIVE_ENG;

        driverStr = CustomConfiguration.getString("hive.jdbc.driverClassName");
        if (!ToolUtils.isNotNull(driverStr)) {
            driverStr = Constant.HIVE_DRIVER;
        }

        urlStr = CustomConfiguration.getString("hive.jdbc.url");
        if (!ToolUtils.isNotNull(urlStr)) {
            urlStr = Constant.HIVE_CONNECTION;
        }

        usernameStr = CustomConfiguration.getString("hive.jdbc.username");
        if (!ToolUtils.isNotNull(usernameStr)) {
            usernameStr = Constant.HIVE_USER;
        }

        passwordStr = CustomConfiguration.getString("hive.jdbc.password");
        if (!ToolUtils.isNotNull(passwordStr)) {
            passwordStr = Constant.HIVE_PWD;
        }

        customUsernameStr = CustomConfiguration.getString("custom.hive.username");
        if (!ToolUtils.isNotNull(customUsernameStr)) {
            customUsernameStr = Constant.HIVE_USER;
        }

        customPasswordStr = CustomConfiguration.getString("custom.hive.password");
        if (!ToolUtils.isNotNull(customPasswordStr)) {
            customPasswordStr = Constant.HIVE_PWD;
        }
    }

}
